﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OnlineManagement.Common;
namespace OnlineManagement.Web.webs
{
    public partial class BasicSettings : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = string.Empty;
            if (!Page.IsPostBack)
            {
                str = Request.QueryString["str"] ?? "";
                if(string.IsNullOrEmpty(str)||str==BasicSettingsEnum.pigPen.ToString()){
                    PanPigPenSetting.Visible = true;
                }
                if(str==BasicSettingsEnum.feeders.ToString()){
                    PanPigPenSetting.Visible = false;
                }
                
            }
           
            //str.Switch(p => p.Equals(BasicSettingsEnum.pigPen.ToString()), p => LoadUserControls(BasicSettingsEnum.UCPigPenSettings.ToString()))
            //       .Switch(p => p.Equals(string.Empty), p => LoadUserControls(BasicSettingsEnum.UCPigPenSettings.ToString()));


        }

        private void LoadUserControls(string controlName) {
            string path = string.Format(PubConstant.UserControlPath, controlName);
            Control control =this.Page.LoadControl(path);
            this.PanPigPenSetting.Controls.Add(control);
        }
    }
}